{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7656b7fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "67afa487",
   "metadata": {},
   "outputs": [],
   "source": [
    "path = os.path.dirname('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9a432a77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\python_lianxi'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a053ff25",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.exists('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "eecf45c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.makedirs('OsMakedirs.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8bb09ba7",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "module 'os' has no attribute 'dirfile'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_9316/2053310091.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdirfile\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'D:\\python_lianxi\\git_molimoli'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m: module 'os' has no attribute 'dirfile'"
     ]
    }
   ],
   "source": [
    "os.dirfile('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7cdd35ad",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.startfile('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "7c36808d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['.git',\n",
       " '.gitee',\n",
       " '.gitignore',\n",
       " '.ipynb_checkpoints',\n",
       " 'bone.py',\n",
       " 'ceshi_zip.py',\n",
       " 'def.py',\n",
       " 'def_test.py',\n",
       " 'dict_for.py',\n",
       " 'enumerate.py',\n",
       " 'for.py',\n",
       " 'for_test.py',\n",
       " 'hongbao.py',\n",
       " 'hongbao_chenjie.py',\n",
       " 'if_text.py',\n",
       " 'lambda.py',\n",
       " 'lambda_test.py',\n",
       " 'lianxi.py',\n",
       " 'lianxi02.py',\n",
       " 'lianxi03.py',\n",
       " 'lianxi04.py',\n",
       " 'lianxi05.py',\n",
       " 'LICENSE',\n",
       " 'main.py',\n",
       " 'OsMakedirs.txt',\n",
       " 'os_path.ipynb',\n",
       " 'python.py',\n",
       " 'range02.py',\n",
       " 'range_cishu.py',\n",
       " 'str_test.ipynb',\n",
       " 'str_test.py',\n",
       " 'tihuan_str.py',\n",
       " 'while.py']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.listdir('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "5e527e0a",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (Temp/ipykernel_9316/1798189699.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"C:\\Users\\cj\\AppData\\Local\\Temp/ipykernel_9316/1798189699.py\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    is.isdir('D:\\python_lianxi\\git_molimoli')\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "is.isdir('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "52d462cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.isdir('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2ca22c6e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.isfile('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "823301e8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\python_lianxi\\\\git_molimoli'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.abspath('')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "76f2476d",
   "metadata": {},
   "outputs": [],
   "source": [
    "join_path = os.path.join(os.path.abspath(''),'for.py')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "2051e5cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\python_lianxi\\\\git_molimoli\\\\for.py'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "join_path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "2834e848",
   "metadata": {},
   "outputs": [],
   "source": [
    "split_path, f_name = os.path.split(join_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "7124d4b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\python_lianxi\\\\git_molimoli'"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "split_path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "facb531a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'for.py'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "fae59f5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('for', '.py')"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.splitext(f_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "12b06ce3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\python_lianxi'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.dirname('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "e83bf878",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.path.exists('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "af15cc17",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.makedirs('ceshi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "8e3e5a9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.startfile('D:\\python_lianxi\\git_molimoli')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e27f5781",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
